(function(){"use strict";BX.namespace("BX.Landing.UI.Tool");var n=BX.Landing.Utils.onCustomEvent;var o=BX.Landing.Utils.removeCustomEvent;var i=BX.Landing.Utils.fireCustomEvent;var e=BX.Landing.Utils.isString;var t=BX.Landing.Utils.isFunction;var r=BX.Landing.Utils.proxy;BX.Landing.UI.Tool.ImageEditor=function(){this.editor=new Aviary.Feather({apiKey:"b365916b2f9244a6bffcae8f9993b35e",apiVersion:3,theme:"light",language:this.getLang(),onSave:a.bind(null,this),onError:d.bind(null,this),onClose:s.bind(null,this)})};function a(n,o,e){n.editor.close();n.resolver(e);i(n,"BX.Landing.UI.Tool.ImageEditor:save",[e])}function d(n,o){console.error(o);i(n,"BX.Landing.UI.Tool.ImageEditor:error",[o])}function s(n,o){i(n,"BX.Landing.UI.Tool.ImageEditor:close",[o])}function l(n,o){if(!e(n)){throw new TypeError(o+" should be a string")}}function g(n,o){if(!t(n)){throw new TypeError(o+" should be a function")}}function u(n){if(!n.includes("BX.Landing.UI.Tool.ImageEditor")){return"BX.Landing.UI.Tool.ImageEditor:"+n}return n}BX.Landing.UI.Tool.ImageEditor.getInstance=function(){return BX.Landing.UI.Tool.ImageEditor.instance||(BX.Landing.UI.Tool.ImageEditor.instance=new BX.Landing.UI.Tool.ImageEditor)};BX.Landing.UI.Tool.ImageEditor.prototype={edit:function(n){return new Promise(function(o){this.resolver=o;this.editor.launch(n)}.bind(this))},on:function(o,i,a){if(!e(o)){throw new TypeError("Event should be a string")}if(!t(i)){throw new TypeError("Handler should be a function")}o=u(o);n(this,o,r(i,a))},off:function(n,i,a){if(!e(n)){throw new TypeError("Event should be a string")}if(!t(i)){throw new TypeError("Handler should be a function")}n=u(n);o(this,n,r(i,a))},getLang:function(){return"en"}}})();